package cn.itcast.daoTest;

import cn.itcast.dao.UserMapper;
import cn.itcast.domain.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/applicationContext-*.xml"})
public class UserMapperTest {

    @Autowired
    private UserMapper userMapper;

    @Test
    public void saveUserTest(){
        User user = new User();
        user.setUsername("李东奎");
        user.setSex("男");
        user.setBirthday(new Date());
        user.setAddress("郑州市");
        userMapper.saveUser(user);
    }

    @Test
    public void Test2(){
        User user = userMapper.getUserById(1);
        System.out.println(user);
    }

    @Test
    public void Test3(){
        List<User> users = userMapper.getUsers("东", "男");
        System.out.println(users);
    }
    @Test
    public void Test4(){

    }


}
